package leetcode_901_1000;

public class LeeCode_997 {
    public static void main(String[] args) {

    }
    private static int findJudge(int n, int[][] trust) {
        int[][] dp = new int[n + 1][2];
        for (int[] t : trust) {
            dp[t[1]][1]++;
            dp[t[0]][0]++;
        }
        for (int i = 1; i <= n; i++) {
            if (dp[i][0] == 0 && dp[i][1] == n - 1){
                return i;
            }
        }
        return -1;
    }
}
